import type { PlanCycleVO, PlanCycleForm, PlanCycleQuery } from './model';

import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common';

import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';

/**
 * 查询健康方案频次列表
 * @param params
 * @returns 健康方案频次列表
 */
export function planCycleList(params?: PlanCycleQuery) {
  return requestClient.get<PageResult<PlanCycleVO>>(
    '/business/planCycle/list',
    { params },
  );
}

/**
 * 导出健康方案频次列表
 * @param params
 * @returns 健康方案频次列表
 */
export function planCycleExport(params?: PlanCycleQuery) {
  return commonExport('/business/planCycle/export', params ?? {});
}

/**
 * 查询健康方案频次详情
 * @param id id
 * @returns 健康方案频次详情
 */
export function planCycleInfo(id: ID) {
  return requestClient.get<PlanCycleVO>(`/business/planCycle/${id}`);
}

/**
 * 新增健康方案频次
 * @param data
 * @returns 频次id
 */
export function planCycleAdd(data: PlanCycleForm) {
  return requestClient.post<string>('/business/planCycle', data);
}

/**
 * 更新健康方案频次
 * @param data
 * @returns void
 */
export function planCycleUpdate(data: PlanCycleForm) {
  return requestClient.putWithMsg<void>('/business/planCycle', data);
}

/**
 * 删除健康方案频次
 * @param id id
 * @returns void
 */
export function planCycleRemove(id: ID | IDS) {
  return requestClient.deleteWithMsg<void>(`/business/planCycle/${id}`);
}
